<?php
/***************************************************************************
   Coppermine 1.3.1 for CPG-Dragonfly™
  **************************************************************************
   Port Copyright (c) 2004-2005 CPG Dev Team
   http://dragonflycms.com/
  **************************************************************************
   v1.1 (c) by Grégory Demar http://coppermine.sf.net/
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
****************************************************************************/
if (!defined('CPG_NUKE')) { die("You can't access this file directly..."); }
define('PROFILE_PHP', true);
require("modules/{$module_name}/include/load.inc");

global $db;
if (!USER_ID) cpg_die(_ERROR, ACCESS_DENIED);

$user_data = $db->uFetchAssoc("SELECT username, user_email, user_regdate as user_regdate_cp, group_name, " . "user_from, user_interests, user_website, user_occ, "
	."COUNT(pid) as pic_count, ROUND(SUM(total_filesize)/1024) as disk_usage, group_quota "
	."FROM {$CONFIG['TABLE_USERS']} AS u "
	."INNER JOIN {$CONFIG['TABLE_USERGROUPS']} AS g ON user_group_cp = group_id "
	."LEFT JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON category = " . FIRST_USER_CAT . " + user_id "
	."LEFT JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.aid = a.aid "
	."WHERE user_id ='" . USER_ID . "' "
	."GROUP BY user_id, username, user_email, user_regdate, group_name, user_from, user_interests, user_website, user_occ, group_quota");

if (!$user_data) cpg_die(_ERROR, $lang_register_php['err_unk_user']);

$title = sprintf(X_S_PROFILE, CPG_USERNAME);
pageheader($title);

starttable(-1, $title, 2);
echo '
<tr>
	<td width="40%">'.USERNAME.'</td>
	<td width="60%">'.$user_data['username'].'</td>
</tr>
<tr>
	<td width="40%">'.GROUP.'</td>
	<td width="60%">'.$user_data['group_name'].'</td>
</tr>
<tr>
	<td width="40%">'.DISK_USAGE.'</td>
	<td width="60%">'.($user_data['disk_usage']?:0).'</td>
</tr>';
endtable();

require_once('modules/Your_Account/functions.php');
require("modules/Your_Account/userinfo.php");
userinfo(USER_ID);

